package com.workstudy.wstudy.domain;

public class Constants {

    /**
     * 审批状态枚举
     * 审批中、待审批、审批成功(通过/发布)、签收异议失败、审批失败(不通过)、撤销、接受、拒绝
     */
    public enum ApprovalStatus {
        PENDING("PENDING"), WAITING_FOR_APPROVAL("WAITING_FOR_APPROVAL"), APPROVAL_SUCCESS("APPROVAL_SUCCESS"), APPROVAL_FAILED("APPROVAL_FAILED"),APPLY_REVOKE("APPLY_REVOKE"),AGREE("AGREE"),DISAGREE("DISAGREE");
        private final String value;
        private ApprovalStatus(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return this.value;
        }

        public static ApprovalStatus getValue( String value ) {
            ApprovalStatus as = null;
            switch (value) {
                case "PENDING":
                    as = PENDING;//审核中
                    break;
                case "WAITING_FOR_APPROVAL":
                    as = WAITING_FOR_APPROVAL;//未提交审核
                    break;
                case "APPROVAL_SUCCESS":
                    as = APPROVAL_SUCCESS;//审核成功
                    break;
                case "APPROVAL_FAILED":
                    as = APPROVAL_FAILED;//审核失败
                    break;
                case "APPLY_REVOKE":
                    as = APPLY_REVOKE;//撤销
                    break;
                case "AGREE":
                    as = AGREE;//接受
                    break;
                case "DISAGREE":
                    as = DISAGREE;//拒绝
                    break;
                default:
                    break;
            }
            return as;
        }
    }

    /**
     * 任务状态   未发布、办理中、已办结
     */
    public enum PostStatus{
        WAIT_FOR_PUBLISH("WAIT_FOR_PUBLISH"),IN_HANDING("IN_HANDING"), FINISHED("FINISHED");
        private final String value;
        private PostStatus(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return this.value;
        }

        public static PostStatus getValue(String value) {
            PostStatus tis = null;
            switch(value) {
                case "WAIT_FOR_PUBLISH":
                    tis = WAIT_FOR_PUBLISH;//未发布
                    break;
                case "IN_HANDING":
                    tis = IN_HANDING;//办理中
                    break;
                case "FINISHED":
                    tis = FINISHED;//已办结
                    break;
                default:
                    break;
            }
            return tis;
        }
    }

    /**
     * 申请状态   可申请、办理中、已办结
     */
    public enum ApplyStatus{
        CAN_BE_APPLY("CAN_BE_APPLY"),IN_HANDING("IN_HANDING"), FINISHED("FINISHED"),ON("ON"),OFF("OFF");
        private final String value;
        private ApplyStatus(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return this.value;
        }

        public static ApplyStatus getValue(String value) {
            ApplyStatus applyStatus = null;
            switch(value) {
                case "CAN_BE_APPLY":
                    applyStatus = CAN_BE_APPLY;//未发布
                    break;
                case "IN_HANDING":
                    applyStatus = IN_HANDING;//办理中
                    break;
                case "FINISHED":
                    applyStatus = FINISHED;//已办结
                    break;
                case "ON":
                    applyStatus = ON;//在职
                    break;
                case "OFF":
                    applyStatus = OFF;//离职
                    break;
                default:
                    break;
            }
            return applyStatus;
        }
    }

    public enum MessageType{
        SYSTEM("SYSTEM"),PERSON("PERSON");
        private final String value;
        private MessageType(String value) {
            this.value = value;
        }
        @Override
        public String toString() {
                    return this.value;
                }
        public static MessageType getValue(String value){
            MessageType mt = null;
            switch(value) {
                case "SYSTEM":
                    mt = SYSTEM;//系统消息
                    break;
                case "PERSON":
                    mt = PERSON;//人的消息
                    break;
                default:
                    break;
            }
            return mt;
        }
    }

    public enum ROLEKEY{
        ADMIN("admin"),STUDENT("student"),ADMINISTER("administer"),LEADER("leader");

        private final String value;

        private ROLEKEY(String value){
            this.value = value;
        }

        @Override
        public String toString(){
            return this.value;
        }
        public static ROLEKEY getValue(String value){
            ROLEKEY rt = null;
            switch (value){
                case "admin":
                    rt=ADMIN; //超级管理员
                    break;
                case "student":
                    rt=STUDENT; //贫困生
                    break;
                case "administer":
                    rt=ADMINISTER; //助贫办管理员
                    break;
                case "leader":
                    rt=LEADER; //用工部门负责人
                    break;
                default:
                    break;
            }
            return rt;
        }
    }
//    对于postUser中的状态定义 0在职，1不在职,2申请中。
}
